package three;

import java.util.Scanner;

public class test8601 {
    public static void main(String[] args) {
        int m, n, p;
        Scanner scanner = new Scanner(System.in);
        m = scanner.nextInt();
        n = scanner.nextInt();
        p = scanner.nextInt();
        int[][][] array = new int[m + 1][n + 1][p + 1];
        for (int i = 1; i <= m; i++)
            for (int j = 1; j <= n; j++)
                for (int k = 1; k <= p; k++)
                    array[i][j][k] = scanner.nextInt();
        System.out.println(MaxSum3(m, n, p, array));

    }

    private static int MaxSum(int n, int[] a) {
        int sum = 0, b = 0;
        for (int i = 1; i <= n; i++) {
            if (b > 0) {
                b = a[i] + b;
            } else {
                b = a[i];
            }
            if (sum < b) {
                sum = b;
            }
        }
        return sum;
    }

    private static int MaxSum2(int m, int n, int[][] a) {
        int sum = 0;
        int[] b = new int[n + 1];
        for (int i = 1; i <= m; i++) {
            for (int k = 1; k <= n; k++)
                b[k] = 0;
            for (int j = i; j <= m; j++) {
                for (int k = 1; k <= n; k++) {
                    b[k] = b[k] + a[j][k];
                }
                int max = MaxSum(n, b);
                if (max > sum) {
                    sum = max;
                }
            }
        }
        return sum;
    }

    private static int MaxSum3(int m, int n, int p, int[][][] a) {
        int sum = 0;
        int[][] b = new int[n + 1][p + 1];
        for (int i = 1; i <= m; i++) {
            for (int j = 1; j <= n; j++)
                for (int k = 1; k <= p; k++)
                    b[j][k] = 0;
            for (int t = i; t <= m; t++) {
                for (int j = 1; j <= n; j++) {
                    for (int k = 1; k <= p; k++) {
                        b[j][k] = b[j][k] + a[t][j][k];
                    }
                }
                int max = MaxSum2(n, p, b);
                if (max > sum) {
                    sum = max;
                }
            }
        }
        return sum;
    }
}
